package order

import (
	//"bee/models"
	//"bee/pkg/logging"
	//"github.com/go-resty/resty/v2"
	//"github.com/tidwall/gjson"
	//"net/http"
	//"strings"
)

// 账户
type Account struct {
	CustomerID      string   `json:"customerId"`
	ServiceType     string   `json:"serviceType"`
	ProductIDList   []string `json:"productIdList"`
	InvoiceProperty string   `json:"invoiceProperty"`
	AccountType     string   `json:"accountType"`
	PlatformType    string   `json:"platformType"`
}

func SetAccount(customerId, appNamespace string) (identityId string, accountId int, err error) {
	return "", 0, nil

	//appName := "opc"
	//uri := "/api/opc/account/createAccount"
	//
	//headers := make(map[string]string)
	//headers["Content-Type"] = "application/json;charset=UTF-8"
	//
	//account := Account{
	//	CustomerID:      customerId,
	//	ServiceType:     "01",
	//	ProductIDList:   []string{"32575", "32574", "32573"},
	//	InvoiceProperty: "1",
	//	AccountType:     "1",
	//	PlatformType:    "1",
	//}
	//
	//appId, appErr:= models.GetAppIdByName(appName)
	//if appErr != nil {
	//	return "", -1, appErr
	//}
	//
	//appEnv, envErr:= models.GetAppEnvInfo(appId, appNamespace)
	//if envErr != nil {
	//	return "", -1, envErr
	//}
	//
	//host := appEnv.AppDomain
	//if !strings.HasPrefix(host, "http://") {
	//	host = "http://" + host
	//}
	//
	//logging.ZapLogger.Infow("创建账户", "域名", host)
	//ssoCookie := &http.Cookie{
	//	Name:       "sso-epctoken",
	//	Value:      appEnv.Token,
	//}
	//logging.ZapLogger.Infow("创建账户", "客户id", customerId, "域名", host, "token", appEnv.Token)
	//
	//client := resty.New()
	//accountResp, accountErr := client.R().EnableTrace().
	//	SetCookie(ssoCookie).
	//	SetHeaders(headers).SetBody(account).
	//	Post(host + uri)
	//
	//if accountErr != nil {
	//	return "", -1, accountErr
	//}
	//
	//logging.ZapLogger.Infow("创建结果", "resp", accountResp)
	//
	//identityId = gjson.Get(accountResp.String(), "data.identityId").String()
	//accountId = int(gjson.Get(accountResp.String(), "data.accountId").Int())
	//
	//logging.ZapLogger.Infow("创建客户成功", "identityId", identityId, "accountId", accountId)
	//return identityId, accountId, nil
}